smbus_headers = [
    'std_smbus.h',
    'smbus.h',
    'smbus_postbox.h',
]

smbus_sources = [
    'std_smbus.cpp',
    'smbus.cpp',
    'smbus_postbox.cpp',
]


libsmbus = shared_library(
    'dev_smbus',
    smbus_sources,
    include_directories: [dev_inc_dir, include_directories('../../drivers/chip/complex')],
    dependencies: [libmcpp_deps, libprotocol_dep],
    install: true,
    install_dir: lib_dir,
)

libsmbus_dep = declare_dependency(
    link_with: libsmbus,
    include_directories: [dev_inc_dir, include_directories('../../drivers')],
    dependencies: [libmcpp_deps, libprotocol_dep],
)

install_headers(smbus_headers, install_dir: install_inc_dir / 'smbus')

if build_tests and meson_build
  custom_target(
    'copy_dev_smbus',
    output: 'copy_dev_smbus',
    command: ['cp', libsmbus.full_path(), lib_dir],
    depends: libsmbus,
    build_by_default: true,
  )
endif